package ir.sourcecodes.animalsounds;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

public class PlayMusic extends Service {
    float leftVolume = 1.5f;
    float rightVolume = 1.5f;
    MediaPlayer snd;

    public IBinder onBind(Intent intent) {
        return null;
    }

    public void onCreate() {
        super.onCreate();
        this.snd = MediaPlayer.create(G.context, G.resources.getIdentifier("fa1", "raw", G.packageName));
    }

    public int onStartCommand(Intent intent, int i, int i2) {
        MediaPlayer create = MediaPlayer.create(G.context, G.resources.getIdentifier(intent.getStringExtra("SOUNDNAME"), "raw", G.packageName));
        this.snd = create;
        create.start();
        this.snd.setLooping(false);
        return START_STICKY_COMPATIBILITY;
    }

    public void onDestroy() {
        this.snd.stop();
        this.snd.release();
        super.onDestroy();
    }
}
